package service;

import dao.UserDao;
import dao.impl.UserDaoImpl;
import pojo.User;

import java.util.List;

public class UserService {
    private UserDao userDao=new UserDaoImpl();

    public List<User> searchAll(){return userDao.searchAll();}

    public User search(String number) { return userDao.search(number); }

    //登录检索
    public boolean check(String userId,String passWord) {
        User user = userDao.search(userId);
        String realPassword = user.getPassWord();
        if (realPassword.equals(passWord)) {
            return true;
        }
        else {
            return false;
        }
    }

    public void add(User user) { userDao.add(user); }

    public void update(User user){ userDao.update(user); }

    public void delete(String userId){userDao.delete(userId);};
}
